package com.mdp.workflow.client.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mdp.safe.client.entity.Dept;
import com.mdp.workflow.client.entity.WfSysUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;
import java.util.Map;
@DS("adm-ds")
@Transactional(propagation = Propagation.REQUIRES_NEW)
public interface WfSysUserMapper extends BaseMapper<WfSysUser> {

    List<String> selectUseidsByDeptids(Collection<String> deptids);

    List<String> selectUseidsByPostIds(Collection<String> postIds);

    List<String> selectUseidsByRoleids(Collection<String> roleids);

    /**
     * 自定义查询，支持多表关联
     * @param page 分页条件
     * @param ew 一定要，并且必须加@Param("ew")注解
     * @param ext 如果xml中需要根据某些值进行特殊处理，可以通过这个进行传递，非必须，注解也可以不加
     * @return
     */
    public List<Map<String,Object>> selectListMapByWhere(IPage page, @Param("ew") QueryWrapper ew, @Param("ext") Map<String,Object> ext);

    Dept getDept(String deptid);

    List<Map<String, String>> selectSimpleUsersByUserids(Collection<String> userids);

    List<Dept> selectDeptListByDeptids(Collection<String> depptids);
}
